<!DOCTYPE html>
<html lang="en">
<head>
    <title></title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <script src="https://file.ggxqce.com/web/vue.min.js"></script>
    <link rel="stylesheet" href="/dist/plugins/webuploader-0.1.5/webuploader.css">
    <style>
        [v-cloak] {
            display: none;
        }

        * {
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            box-sizing: border-box;
            font-size: 12px;
        }

        body {
            margin: 1px;
            background: white;
        }
        .progressobj {
            display: flex;
            justify-content: space-between;
            height: 20px;
        }

        .jiaobiao, .jiaobiaoNew {
            position: relative;
        }

        .jiaobiao i {
            display: block;
            width: 0;
            height: 0;
            border-width: 0px 0 12px 12px;
            border-style: solid;
            border-color: transparent transparent transparent #2a8cec;
            position: absolute;
            top: 0px;
            left: 0px;
        }

        .progressobj .delfile {
            float: right;
            margin-right: 10px;
        }

        table {
            border-spacing: 0;
            border-collapse: collapse;
            display: table;
        }

        table.text-center, table.text-center td, table.text-center th {
            text-align: center;
            font-size: 12px;
        }

        .table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td {
            border: 1px solid #cbcbcd;
            font-weight: normal;
            height: 24px;
        }

        table th {
            background: #f8f8f8;
        }

        .table-bordered {
            border: 1px solid #cbcbcd;
        }

        .table {
            width: 100%;
            max-width: 100%;
        }

        .hidden {
            display: none;
        }

        .lineOne {
            text-align: left;
        }

        .lineOne span {
            max-height: 24px;
            /*line-height: 24px;*/
            overflow: hidden;
            text-overflow: ellipsis;
            /*display: -webkit-box;*/
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }

        .mScrollBox {
            float: left;
            position: relative;
            overflow: hidden;
        }

        .infoReport {
            text-align: center;
            margin: 0;
            margin-bottom: 10px;
        }

        .moduleName {
            height: 20px;
            line-height: 20px;
            background: #f8f8f8;
            font-weight: bold;
            font-size: 14px;
        }
        .toggleDiv div {
            width: 50%;
            float: left;
            text-align: center;
        }

        .toggleDiv div.active {
            border-bottom: 2px solid #2289ee;
        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }
        .text-center{
            text-align: center;
        }
        .td-title{
            background-color: #F5F5F5;
        }

        element.style {
            width: 16%;
        }
        .table-detail {
            width: 100%;
            border-left: 1px solid #e8e8e9;
            border-top: 1px solid #e8e8e9;
            border-spacing: 0;
            /*table-layout: fixed;*/
        }
        .table-detail .td-title {
            background-color: #f5f5f5;
        }
        .table-detail td {
            border-right: 1px solid #e8e8e9;
            border-bottom: 1px solid #e8e8e9;
            padding-left: 0px !important;
            padding-right: 0px !important;
            padding-top: 0px !important;
            padding-bottom: 0px !important;
            height: 29px;
            /*line-height: 29px;*/
            text-align: center;
            position: relative;
            overflow: hidden;
            word-wrap: break-word;
        }
        .table-detail td input{
            display: inline-block;
            outline: none;
            border:0;
            /*background: #F8F8F8;*/
            padding:0;
            margin:0;
            width:93px;
            text-align: center;
            color: #2a8cec;
        }
       /* .table-detail td span{
            color: #2a8cec;
        }*/
        .table-detail td textarea,.table-detail td select{
            width:100%;
            height:100%;
            line-height: 100%;
            padding-top: 20px;
            padding-left: 6px;
            outline: none;
            resize: none;
            border: none;
            color: #2a8cec;
        }
        .table-detail td select{
            padding-top: 0px;
            padding-left:0px;
            width:auto;
            border:none;
            color: #2a8cec;
        }
        .btn {
            border-radius: 3px;
            -webkit-box-shadow: none;
            box-shadow: none;
            border: 1px solid transparent;
        }
        .btn-primary {
            background-color: #228bee;
            border-color: #127ee5;
            color: #fff;
        }
        .btn-group-sm > .btn, .btn-sm {
            padding: 5px 10px;
            font-size: 12px;
            line-height: 1.5;
            border-radius: 3px;

        }
        .model-picker-input {
            opacity: 0 !important;
            top: -9999px;
            left: -9999px;
            position: absolute;
        }

        .model-picker-span {
            position: relative;
            display: block;
            outline: 0;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            border-bottom: 1px solid #ccc;
            background-color: #fff;
            color: #ccc;
            cursor: pointer;
        }

        .model-picker-span>.placeholder {
            color: #aaa;
        }

        .model-picker-span>.arrow {
            position: absolute;
            top: 50%;
            right: 8px;
            width: 10px;
            margin-top: -3px;
            height: 5px;
            background: url(../images/drop-arrow.png) -10px -25px no-repeat;
        }

        .model-picker-span.focus,
        .model-picker-span.open {
            border-bottom-color: #46A4FF;
        }

        .model-picker-span.open>.arrow {
            background-position: -10px -10px;
        }

        .model-picker-span>.title>span {
            color: #333;
            padding: 5px;
            border-radius: 3px;
        }

        .model-picker-span>.title>span:hover {
            background-color: #f1f8ff;
        }

        .model-picker-dropdown {
            position: absolute;
            width: 315px;
            left: -9999px;
            top: -9999px;
            outline: 0;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            z-index: 999999;
            display: none;
            min-width: 330px;
            margin-bottom: 20px;
            margin-top: 10px;
        }

        .model-select-wrap {
            width: 75%;
            box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
        }

        .model-select-tab {
            border-bottom: 1px solid #ccc;
            background: #f5f5f5;
            font-size: 13px;
        }

        .model-select-tab>a {
            display: inline-block;
            padding: 4px 20px;
            border-left: 1px solid #ccc;
            border-bottom: 1px solid transparent;
            color: #4D4D4D;
            text-align: center;
            outline: 0;
            text-decoration: none;
            cursor: pointer;
            font-size: 14px;
            margin-bottom: -1px;
        }

        .model-select-tab>a.active {
            background: #fff;
            border-bottom: 1px solid #fff;
            color: #46A4FF;
        }

        .model-select-tab>a:first-child {
            border-left: none;
        }

        .model-select-tab>a:last-child.active {
            border-right: 1px solid #ccc;
        }

        .model-select-content {
            width: 100%;
            min-height: 10px;
            background-color: #fff;
            /*padding: 5px 5px;*/
        }

        .model-select {
            font-size: 13px;
        }

        .model-select dl {
            line-height: 2;
            clear: both;
            padding: 3px 0;
            margin: 0;
        }

        .model-select dt {
            position: absolute;
            width: 2.5em;
            font-weight: 500;
            text-align: right;
            line-height: 2;
        }

        .model-select dd {
            margin-left: 0;
            line-height: 2;
        }

        .model-select.province dd {
            margin-left: 3em;
        }

        .model-select a {
            display: inline-block;
            padding: 0 10px;
            outline: 0;
            text-decoration: none;
            white-space: nowrap;
            margin-right: 2px;
            text-decoration: none;
            color: #333;
            cursor: pointer;
        }

        .model-select a:hover,
        .model-select a:focus {
            background-color: #f1f8ff;
            border-radius: 2px;
            color: #46A4FF;
        }

        .model-select a.active {
            background-color: #46A4FF;
            color: #fff;
            border-radius: 2px;
        }
        td {
            color: #2a8cec;
        }
        td.td-title, td select, td .filename, td.td-module {
            color: #333;
        }
        td.td-value,span{
            padding-left: 6px;
        }
        td.td-value{
            background-color: white;
        }
        .user {
            height: 30px;
            line-height: 30px;
            max-height: 30px;
            float: left;
            text-align: left;
            /*min-width: 32px;*/
            padding-left: 1px;
            overflow: hidden;
            cursor: pointer;
        }

        .user:hover {
            background-color: #cfd4d1;
        }
        td .lookFj {
            /*width: 100%;*/
            color: #2a8cec;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            position: relative;
            cursor: pointer;
            background: none;
            padding-left: 6px;
            text-align: left;
            height: 100%;
            width: 200px;
        }
        .fujian {
            /*display: inline-block;*/
            cursor: pointer;
            padding-left: 19px;
            background: url(/dist/img/fujian.png) no-repeat 6px center;
            color: #2a8cec;
        }
        .lineTwo span {
            line-height: 16px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            text-align: left;
        }
    </style>
</head>
<body>
<section class="content" id="app" v-cloak>
    <!--<h4 class="text-center" style="margin:10px 10px;">{{money.main.title}}</h4>-->
    <div class="center" style="overflow:auto;overflow-x:hidden;padding-bottom: 51px;">
        <table class="table-detail">
            <tr>
                <td class="td-title" colspan="4" style="text-align: center;">基本信息</td>
            </tr>
            <tr>
                <td class="td-title" style="width:18%;">用款类型</td>
                <td clsss="td-value" style="width:32%;text-align: left;background-color: white;"><span>{{money.main.type}}</span></td>
                <td class="td-title" style="width:18%;">申请人</td>
                <td clsss="td-value" style="width:32%;text-align: left;background-color: white"><span>{{money.main.createUserName}}</span></td>
            </tr>
            <tr>
                <td class="td-title">用款部门</td>
                <td clsss="td-value" style="text-align: left;background-color: white"><span>{{money.main.orgName}}</span></td>
                <td class="td-title">申请时间</td>
                <td clsss="td-value" style="text-align: left;background-color: white"><span>{{formatDate(money.main.createTime)}}</span></td>
            </tr>
            <tr>
                <td class="td-title">用款事由</td>
                <td colspan="3" class="lineTwo">
                    <span>{{money.main.description}}</span>
                </td>
            </tr>
            <tr>
                <td class="td-title">用款金额</td>
                <td colspan="3" clsss="td-value" style="text-align: left;background-color: white">
                    <span @keyup="convertToChinese(item)" min="0" max="999999999">¥{{money.main.money}}元({{convertToChinese(money.main.money)}})</span>
                    <!--{{item.payeeMoney?"¥"+item.payeeMoney:""}}{{item.payeeMoneyChinese?"("+item.payeeMoneyChinese+")":""}}-->
                </td>
            </tr>
           <!-- <tr>
                <td class="td-title">是否紧急</td>
                <td clsss="td-value" colspan="3" style="text-align: left;background-color: white">
                   <span v-if="currentFlag">
                        <input style="margin-left: 10px;width: 16px;" type="radio" value="1" v-model="currentFlag" >
                        <label>是</label>
                        <input style="margin-left: 10px;width: 16px;" type="radio" value="0" v-model="currentFlag">
                        <label>否</label>
                    </span>
                    <span v-else class="pull-left" style="margin-left: 18.5%">{{flag.value=='1'?'是':'否'}}</span>
                </td>
            </tr>-->

            <template v-if="money.main.type == '费用报销'">
                <tr>
                    <td class="td-title">是否紧急</td>
                    <td clsss="td-value"  style="text-align: left;background-color: white">
                        <span>{{money.main.urgentFlag =='1'?'是':'否'}}</span>
                    </td>
                    <td class="td-title">发票提交<br/>方式</td>
                    <td clsss="td-value" style="text-align: left;background-color: white">
                        <span>{{money.main.submission}}</span>
                    </td>
                </tr>
            </template>
            <template v-else>
                <tr>
                    <td class="td-title">是否紧急</td>
                    <td clsss="td-value" colspan="3"  style="text-align: left;background-color: white">
                        <span>{{money.main.urgentFlag =='1'?'是':'否'}}</span>
                    </td>
                </tr>
            </template>
            <tr>
                <td class="td-title" style="width:16%;">附件</td>
                <td style="width:33%;" colspan="3" >
                    <div id="divUploadedFiles" >
                        <div v-for="(attach,i) in money.attaches" class="progressobj fujian">
                            <!--<input type="button" class="IcoNormal" style="float:left;"/>-->
                            <div class="filename" style="float:left;padding-left: 10px;color: #2a8cec;">
                                <a href="javascript:void(0);" @click="look(attach.url)" style="color: #2a8cec;">{{attach.name}}</a>
                            </div>
                            <!--<div class="delfile">-->
                                <!--<span v-if=""><a href="javascript:void(0);"-->
                                                                 <!--@click="deleteFile(i)">删除</a></span>-->
                                <!--<a href="javascript:void(0);"-->
                                   <!--@click="download(attach.url,attach.name)">下载</a>-->
                            <!--</div>-->
                        </div>
                    </div>
                    <div v-if="money.attaches.length==0&&pageType!='edit'" style="text-align: left;"><span class="sp-value">无</span></div>
                </td>
            </tr>
        </table>
        <table class="table-detail" v-for="(item,i) in money.payees" style="width:100%;">
            <!--收款部分-->
            <tr>
                <td class="td-title" colspan="4" style="text-align: center;">收款人</td>
            </tr>
            <tr>
                <td class="td-title" style="width:18%;">收款人</td>
                <td style="width:32%;text-align: left;background-color: white;padding-left: 6px;"><span>{{item.payeeName}}</span></td>
                <td class="td-title" style="width:18%;">付款方式</td>
                <td style="width:32%;text-align: left;background-color: white"><span>{{item.payeeType}}</span></td>
            </tr>
            <tr>
                <td class="td-title">用款金额</td>
                <td colspan="3" clsss="td-value" style="text-align: left;background-color: white">
                    <span @keyup="convertToChinese(item)" min="0" max="999999999">
                        ¥{{item.payeeMoney}}元({{convertToChinese(item.payeeMoney)}})
                    </span>
                </td>
            </tr>
            <tr>
                <td class="td-title">冲账方式</td>
                <td colspan="3" clsss="td-value" style="text-align: left;background-color: white"><span>{{item.offTheWay}}</span></td>
            </tr>
            <tr>
                <td class="td-title">冲账日期</td>
                <td colspan="3" clsss="td-value" style="text-align: left;background-color: white"><span>{{item.offTime}}</span></td>
            </tr>
            <tr>
                <td class="td-title">开户银行</td>
                <td colspan="3" clsss="td-value" style="text-align: left;background-color: white"><span>{{item.bankName}}</span></td>
            </tr>
            <tr>
                <td class="td-title">账户</td>
                <td colspan="3" clsss="td-value" style="text-align: left;background-color: white"><span>{{item.bankCardNumber}}</span></td>
            </tr>
        </table>
        <table class="table-detail" style="width: 100%;table-layout: auto;">
            <tr>
                <td class="td-title" colspan="4" style="text-align: center;width: 100%;">审批进度</td>
            </tr>
            <tr v-for="(item,i) in money.auditors">
                <td class="td-title" style="width: 18%">
                    <span>第{{i+1}}审核人</span>
                </td>
                <td style="width: 32%;text-align: left;">
                    <span>{{item.auditorName}}</span>
                </td>
                <td style="width: 18%;text-align: left;">
                    <span v-if="item.auditFlag==0 || item.auditFlag==2" style="color:red;">{{convertAuditFlagToName(item.auditFlag)}}</span>
                    <span v-else>{{convertAuditFlagToName(item.auditFlag)}}</span>
                </td>
                <td style="width: 32%;text-align: left;">
                    <span v-if="item.auditTime">{{formatDate(item.auditTime)}}</span>
                    <span v-else></span>
                </td>
            </tr>
            <tr>
                <td class="td-title" style="width:16%;">抄送人</td>
                <td colspan="5">
                    <div id="user" style="padding-left:6px;">
                        <div v-for="(user,i) in money.copiers" class="user">
                            {{user.copyPersonName}};
                        </div>
                        <!--<input v-if="" class="pull-left copier" id="txtCopier"-->
                               <!--style="width:100px"-->
                               <!--type="text" />-->
                    </div>
                </td>
            </tr>
        </table>
        <!--历史驳回记录-->
        <table class="table-detail" style="width: 100%;" v-if="money.historys && money.historys.length>0">
            <tr>
                <td class="td-title" colspan="4" style="text-align: center;">历史驳回记录</td>
            </tr>
            <template  v-for="(item,i) in money.historys">
                <tr>
                    <td class="td-title"  style="width: 18%;" ><i></i>审核人</td>
                    <td style="width:32%;text-align: left;background-color: white"><span>{{item.auditorName}}</span></td>
                    <td class="td-title" style="width:18%;line-height: 20px;" >审核时间</td>
                    <td style="width:32%;text-align: left;background-color: white"><span>{{formatDate(item.auditTime)}}</span></td>
                </tr>
                <tr>
                    <td class="td-title"> 驳回原因</td>
                    <td class="td-value" colspan="3" style="text-align: left;background-color: white">
                        <span>{{item.auditAdvise}}</span>
                    </td>
                </tr>
            </template>
        </table>
        <table class="table-detail" style="width: 100%;">
            <tr>
                <td class="td-title" colspan="4" style="text-align: center;">付款信息</td>
            </tr>
            <tr>
                <td class="td-title" style="width: 18%;">付款人员</td>
                <td clsss="td-value" style="text-align: left;background-color: white;width: 32%;"><span>{{money.main.payUserName}}</span></td>
                <td class="td-title" style="width: 18%;">付款状态</td>
                <td clsss="td-value" style="text-align: left;background-color: white;width: 32%;">
                    <span :style="money.main.auditFlag=='6'?'':'color:red;'">{{money.main.auditFlag=='6'?"已付款":"未付款"}}</span>
                </td>
            </tr>
            <tr>
                <td class="td-title">付款时间</td>
                <td colspan="3" clsss="td-value" style="text-align: left;background-color: white">
                    <span>{{money.main.payDate}}</span>
                </td>
            </tr>
            <tr>
                <td class="td-title">备注</td>
                <td colspan="3" clsss="td-value" style="text-align: left;background-color: white"><span>{{money.main.payRemark}}</span></td>
            </tr>
        </table>
    </div>
    <div class="south no-print" style="height:50px;line-height:50px;text-align:center;bottom:0;position: fixed;width: 100%;">
        <div v-if="pageType=='applyAudit' && money.main.auditFlag=='0' "
             value="" class="" @click="applyAudit('1')"
             style="background-color: #228bee;width: 50%;float:left;color:#fff;font-size: 14px;position: relative">
            <span style="position: absolute;width:1px;height:14px;font-size:20px;right:-1px;top:-3px;">|</span>
            通过
        </div>
        <div v-if="pageType=='applyAudit' && money.main.auditFlag=='0' "
             value="" class="" @click="applyAudit('2')"
             style="background-color: #228bee;width: 50%;float:left;color:#fff;font-size: 14px">驳回</div>

        <div v-if="pageType=='payAudit' && money.main.auditFlag=='3' "
             value="" class="" @click="applyAudit('4')"
             style="background-color: #228bee;width: 50%;float:left;color:#fff;font-size: 14px;position: relative">
            <span style="position: absolute;width:1px;height:14px;font-size:20px;right:-1px;top:-3px;">|</span>
            通过
        </div>
        <div v-if="pageType=='payAudit' && money.main.auditFlag=='3' "
             value="" class="" @click="applyAudit('5')"
             style="background-color: #228bee;width: 50%;float:left;color:#fff;font-size: 14px">驳回</div>
    </div>
</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="/dist/plugins/scroll/myScroll.js"></script>
<!--框架已定义 JS-->
<!--oa自定义  JS-->
<script src="/dist/js/oaApp.js"></script>
<script type="text/javascript" src="/dist/js/pages/common/commonService.js"></script>
<script type="text/javascript" src="/dist/js/pages/common/changeMoneyToChinese.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<script src="/dist/plugins/webuploader-0.1.5/webuploader.min.js"></script>
<script>
    $(function () {
        $("body").on("click", ".selectModel", function (e) {
            if ($(".model-picker-dropdown").is(":hidden")) {
                $(".model-picker-dropdown").css({
                    "width": $(this).outerWidth() + "px",
                    "left": $(this).offset().left,
                    "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                }).show();
                e.stopPropagation();
            } else {
                $(".model-picker-dropdown").hide();
            }
        });
        $("body").on("click", ".model-select-tab a", function (e) {
            $(this).parent().find("a").removeClass("active");
            $(this).addClass("active");
            var boxName=$(this).attr("data-count");
            $(".model-select").hide();
            $(".model-select-content"+" ."+boxName).show();
        });
        $("body").on("click", ".model-select  a", function (e) {
            if($(this).hasClass("active")){return false;}
            $(this).parent().find("a").removeClass("active");
            var id=$(this).attr("attr-id");
            $(this).addClass("active");
            if($(this).parents(".model-select").hasClass("type")){
                $(".model-select-tab a").removeClass("active");
                $(".model-select-tab a[data-count=brand]").addClass("active");
                $(".model-select").hide();
                app.getBrand(id);
                $(".model-select-content .brand").show();

            }else if($(this).parents(".model-select").hasClass("brand")){
                $(".model-select-tab a").removeClass("active");
                var id=$(this).attr("attr-id");
                $(".model-select-tab a[data-count=model]").addClass("active");
                $(".model-select").hide();
                app.getModel(id);
                $(".model-select-content .model").show();
            }else{
                app.modelName=$(this).text();
                app.modelId=id;
                $(".model-picker-dropdown").hide();
            }
        })
        $("body").on("click", ".model-picker-dropdown", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".model-picker-dropdown").hide();
        });
    });
</script>
<script>
    $.ajaxSetup({
        global: true,
        type: "POST",
        cache: false,
        dataType: "json",
        contentType: 'application/json;charset=utf-8',
        beforeSend: function () {
        },
        complete: function () {

        },
        error: function (e) {
            alert('error' + e.responseText);
        }
    });
    $.extend($.wyui, {
        postMethod: function (url, data, callback, sync, id) {
            if (!id) {
                id = "#app"
            }
            $.ajax({
                url: server.ip + url,
                async: sync ? false : true,
                data: JSON.stringify(data),
                beforeSend: function () {

                },
                complete: function () {
                    setTimeout(function () {
                    }, 1000);

                },
                success: function (r) {
                    if (!r.e.code) {
                        callback(r.data.sendData);
                    } else {
                        alert(r.e.desc);
                    }
                },
                error: function (e) {
                    alert(url + e.responseText);
                }
            });
        },
    });
</script>
<script type="text/javascript">
       // var api = frameElement.api, W = api.opener;
    function refresh() {
        //app.getById();
        setTimeout(function(){
            //这个可以关闭安卓系统的手机
            document.addEventListener('WeixinJSBridgeReady', function(){ WeixinJSBridge.call('closeWindow'); }, false);
            //这个可以关闭ios系统的手机
            WeixinJSBridge.call('closeWindow');
        }, 100)
    }
    var app = new Vue({
        el:'#app',
        data:{
            pageType:'',
            urlParams: null,
            selectType:"",
            selectBrand:"",
            selectModel:"",
            typeList:[],
            brandList:[],
            modelList:[],
            modelName:"",
            modelId:"",
            buyTypeList: [
                {name: '全款', value: '全款'},
                {name: '内部分期', value: '内部分期'},
                {name: '融资', value: '融资'},
            ],
            flag:[
                {name: '是', value: '1'},
                {name: '否', value: '0'},
            ],
            valveFlag:[
                {name: '是', value: '1'},
                {name: '否', value: '0'},
            ],
            pipelineFlag:[
                {name: '是', value: '1'},
                {name: '否', value: '0'},
            ],
            currentValveFlag:'0',
            currentPipelineFlag:'0',
            currentFlag:'0',
            currentType:'全款',
            list:{},
            money:{
                main:{
                    id:'',
                    type:'',
                    createUserName:'',
                    orgName:'',
                    createTime:'',
                    description:'',
                    money:'',
                    shenghe1:'',
                    shenghe2:'',
                    shenghe3:'',
                    shenghe4:'',
                    yijian1:'同意',
                    yijian2:'同意',
                    yijian3:'同意',
                    yijian4:'同意',
                    shijian1:'16:18 06-05',
                    shijian2:'16:50 06-05',
                    shijian3:'16:15 06-05',
                    shijian4:'17:11 06-05',
                    chaosong:'徐敏;曹国玉;',
                    payUserName:'',
                    auditFlag:'',
                    payDate:'',
                    payRemark:'',
                    title:'',
                    urgentFlag:''
                },
                uploader: null,
                payees: [],
                copiers: [],
                auditors: [],
                historys:[],
                attaches: []//附件

            }
        },
        methods:{
            convertToChinese: function (item) {
                return changeMoneyToChinese(item);
            },
//            formatDate:function(now){
//                var d=new Date(now);
//                var hour=d.getHours();
//                var minute=d.getMinutes();
//                var second=d.getSeconds();
//                var month=d.getMonth()+1
//                var day=d.getDate();
//                if(hour<10){
//                    hour="0"+hour;
//                }
//                if(minute<10){
//                    minute="0"+minute;
//                }
////                    if(month<10){
////                        month="0"+month;
////                    }
////                    if(day<10){
////                        day="0"+day;
////                    }
//                return hour+":"+minute+" "+month+"月"+day+"日";
//            },
            formatDate: function(now) {
                return new Date(now).Format(TimeFormat.middle)
            },
            showDatePicker: function (e, item) {
                var that = this;
                WdatePicker({
                    onpicked: function (dp) {
                        //that.business.main.dealTime = dp.cal.getNewDateStr();
                        return true;
                    }
                });
                $(e.target).blur();
            },
            deleteFile: function (i) {
                this.money.attaches.splice(i, 1);
            },
            download: function (attachId, fileName) {
                downloadFile(attachId,fileName)
                return false;
            },
            allPrice: function () {
                var that = this;
                var num = 0;
                console.log(that.money.payees)
                for (var i = 0; i < that.money.payees.length; i++) {
                    num += parseFloat(that.money.payees[i].payeeMoney);
                }
                if (!num) {
                    num = 0
                }
                ;
                that.price = num.toFixed(2);
                that.priceChinese = changeMoneyToChinese(num.toFixed(2));
            },
            applyAudit: function (auditFlag) {
                if (auditFlag == "2" || auditFlag == "5") {
                } else {
                    if (!confirm("确定要通过吗？")) {
                        return;
                    }
                }
                var that = this;
                var advise = '';
                for (var i = 0; i < this.money.auditors.length; i++) {
                    if (this.money.auditors[i].auditorId == getUrlParamObj().currentAuditorId) {
                        advise = this.money.auditors[i].auditAdvise;
                        break;
                    }
                }
                if (auditFlag == '2' /*&& advise == ''*/) {
                    this.copierReturn(1,'2')
                    //alert('请填写审核意见');
                    return;
                }
                if (auditFlag == '5' /*&& advise == ''*/) {
                    this.copierReturn(1,'5')
                    //alert('请填写审核意见');
                    return;
                }
                if (advise == "") {
                    advise = "同意！";
                }
                $.wyui.postMethod(urlConfig.apply.money.applyAudit, {
                    id: getUrlParamObj().id,
                    userId: getUrlParamObj().currentAuditorId,
                    auditFlag: auditFlag,
                    advise: advise
                }, function () {
                    $.wyui.postMethod(urlConfig.system.message.setMessageReadFlag, {
                        receiverId: getUrlParamObj().receiverId,
                        flag: '1'
                    }, function (r) {
                        console.log(r)
                        alert("审核成功");
                        refresh();
                    });
                });
            },
            copierReturn: function (type,auditFlag) {
                //alert(getUrlParamObj().receiverId)
                //type : 0-抄送人驳回  1-审核人驳回
                $.dialog({
                    content: 'url:copierReturnReasonApp.html?id=' + getUrlParamObj().id + "&currentAuditorId=" + getUrlParamObj().currentAuditorId + "&receiverId=" + getUrlParamObj().receiverId + "&type=" + type + "&auditFlag=" + auditFlag,
                    title: '驳回',
                    width: 300,
                    height: 250,
                    max: false,
                    min: false,
                    lock: true
                });
            },
            convertAuditFlagToName: function (auditFlag) {
                //auditFlag:-1,0,1,2,3,4,5,6
                switch (auditFlag) {
                    case "-1":
                        return "未提交";
                        break;
                    case "0":
                    case "3":
                        return "审核中";
                        break;
                    case "1":
                    case "4":
                        return "通过";
                        break;
                    case "2":
                    case "5":
                        return "驳回";
                        break;
                    default :
                        break;
                }
            },
            changes:function () {

            },
            look:function (url) {
                window.open(url);
            },
            getById:function () {
                var that = this;
                $.wyui.postMethod('/apply/getById.json', {id:getUrlParamObj().id}, function (data) {
                    // alert(getUrlParamObj().id)
                    console.log(data);
                    //如果当前用户是审核人之一
                   /* for (var i = 0; i < that.money.auditors.length; i++) {
                        if (that.money.auditors[i].auditorId == getUrlParamObj().currentAuditorId) {
                            that.showAuditReturnBtn()
                        }
                    }*/
                    if(data.main){
                        var params = {moduleId: data.main.id};
                        commonService.getAttachesByModuleId(params, function (attaches) {
                            if (attaches) {
                                data.attaches = attaches;
                            }
                            that.money = data;
                            document.title = that.money.main.title;
                            if (that.money.payees.length > 0) {
                                for (var i = 0; i < that.money.payees.length; i++) {
                                    that.money.payees[i].payeeMoneyChinese = changeMoneyToChinese(that.money.payees[i].payeeMoney)
                                }
                            }
                            that.allPrice();
                            if(that.money.main.currentAuditorId == getUrlParamObj().currentAuditorId){
                                that.pageType = "applyAudit";
                            }else {
                                that.pageType = '';
                            }
                        });

                    }else{
                        alert("数据异常")
                    }


                });
            }

        },
        mounted: function () {
            $.wyui.postMethod(urlConfig.system.message.setMessageReadFlag,
                {receiverUserId: getUrlParamObj().receiverId,openUrl:'/page/apply/money/detail.html?id=' + getUrlParamObj().id, flag: '1'},
                function (r)
                    {console.log(r)}
                );
            //上传附件
            var that = this;
            this.uploader = WebUploader.create({
                // 选完文件后，是否自动上传。
                auto: true,
                // swf文件路径
                swf: "/statics/plugin/webuploader-0.1.5/Uploader.swf",
                // 文件接收服务端。
                server: server.fjIp + "/attach/uploadFile.json",
                // 选择文件的按钮。可选。
                // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                pick: '#divUpload',
                duplicate: true
            });
            this.uploader.on("uploadStart", function () {
                $("#progress").show();
            });
            this.uploader.on("uploadComplete", function () {
                $("#progress").hide();
            });
            // 文件上传成功，给item添加成功class, 用样式标记上传成功。
            this.uploader.on('uploadSuccess', function (file, response) {
                if (response._raw == "文件上传出错！") {
                    alert("文件上传出错！");
                } else {
                    that.money.attaches.push({
                        id: response.id,
                        name: response.name,
                        url: response.url
                    });
                }
            });
            // 文件上传失败，显示上传出错。
            this.uploader.on('uploadError', function (file) {
                alert("上传失败！");
            });
            this.getById();
        }
    });
</script>
</body>
</html>